package hit.reports;

/**
 * Used to test Builder implementations.
 *
 */
public class TestDesigner implements ReportDesigner{

	@Override
	public void BuildReport(ReportBuilder builder)
	{
		if (builder == null)
			throw new IllegalArgumentException();
		
		builder.setTitle("This is a test title.");
		
		builder.AddObject(new BuilderHeader("This is a Header"));
		
		String newParaValue = "This is a test paragraph. It is slighty " +
			"longer than a normal paragraph. It also includes a newline just for "+
			"fun.\nBy the way, How are you doing today?";
		builder.AddObject(new BuilderParagraph(newParaValue));
		builder.AddObject(new BuilderBreak());
		
		builder.AddObject(new BuilderHeader("This is a Different Header"));
		
		String newParaValue2 = "The following list contains random information " +
			"about olympic medals in Archery as taken from Wikipedia.";
		builder.AddObject(new BuilderParagraph(newParaValue2));
		
		BuilderTable table = new BuilderTable();
		builder.AddObject(table);
		
		TableColumn rankCol = new TableColumn("Rank");
		table.AddColumn(rankCol);
		TableColumn nationCol = new TableColumn("Nation");
		table.AddColumn(nationCol);
		TableColumn goldCol = new TableColumn("Gold");
		table.AddColumn(goldCol);
		TableColumn silverCol = new TableColumn("Silver");
		table.AddColumn(silverCol);
		TableColumn bronzeCol = new TableColumn("Bronze");
		table.AddColumn(bronzeCol);
		TableColumn totalCol = new TableColumn("Total");
		table.AddColumn(totalCol);
		
		TableRow sKoreaRow = new TableRow();
		sKoreaRow.AddItem(rankCol, "1");
		sKoreaRow.AddItem(nationCol, "South Korea");
		sKoreaRow.AddItem(goldCol, "19");
		sKoreaRow.AddItem(silverCol, "9");
		sKoreaRow.AddItem(bronzeCol, "6");
		sKoreaRow.AddItem(totalCol, "34");
		table.AddRow(sKoreaRow);
		
		TableRow usRow = new TableRow();
		usRow.AddItem(rankCol, "2");
		usRow.AddItem(nationCol, "United States");
		usRow.AddItem(goldCol, "8");
		usRow.AddItem(silverCol, "4");
		usRow.AddItem(bronzeCol, "2");
		usRow.AddItem(totalCol, "14");
		table.AddRow(usRow);
		
		TableRow italyRow = new TableRow();
		italyRow.AddItem(rankCol, "3");
		italyRow.AddItem(nationCol, "Italy");
		italyRow.AddItem(goldCol, "2");
		italyRow.AddItem(silverCol, "2");
		italyRow.AddItem(bronzeCol, "3");
		italyRow.AddItem(totalCol, "7");
		table.AddRow(italyRow);
		
		TableRow chinaRow = new TableRow();
		chinaRow.AddItem(rankCol, "4");
		chinaRow.AddItem(nationCol, "China");
		chinaRow.AddItem(goldCol, "1");
		chinaRow.AddItem(silverCol, "6");
		chinaRow.AddItem(bronzeCol, "2");
		chinaRow.AddItem(totalCol, "9");
		table.AddRow(chinaRow);
		
		TableRow suRow = new TableRow();
		suRow.AddItem(rankCol, "5");
		suRow.AddItem(nationCol, "Soviet Union");
		suRow.AddItem(goldCol, "1");
		suRow.AddItem(silverCol, "3");
		suRow.AddItem(bronzeCol, "3");
		suRow.AddItem(totalCol, "7");
		table.AddRow(suRow);
	}
}
